{% extends 'layout/basic.html' %}
{% load static %}
{% block css %}
    <link rel="stylesheet" href="{% static 'css/login_box.css' %}">
{% endblock %}
{% block cotent %}
        <div class="login_box clearfix">
        <form method="post" novalidate>
            {% csrf_token %}
            <h3 style="text-align: center">{{ title }}</h3>
            {% for item in form %}
                {% if item.name == "code" %}
                    <div class="form-group" style="margin-bottom: 25px" >
                        <label for="exampleInputEmail1">{{ item.label }} :</label>
                        <div class="clearfix">
                            <div class="col-xs-7" style="padding-left: 0">{{ item }}</div>
                            <div class="col-xs-5"><img id="imge_code" src="/img/code/" title="点击更换图片"></div>
                            <div class="col-xs-12" style="padding-left: 0"> <span style="color: red;position: absolute;"> {{ item.errors.0 }}</span> </div>
                        </div>
                    </div>
                {% else %}
                    <div class="form-group" style="margin-bottom: 25px">
                        <label >{{ item.label }} :</label>
                        {{ item }}
                        <span class="error"> {{ item.errors.0 }}</span>
                    </div>
                {% endif %}
            {% endfor %}
        <div>
            <a href="/msglogin/">短信验证码登录</a>
            <input style="float: right" type="submit" class="btn btn-success" value="登录"></div>
        </form>
    </div>
{% endblock %}
{% block js %}
    <script>
        $("#imge_code").click(function () {
            var old_src =  $(this).attr("src")
            $(this).attr("src",old_src + "?");
        })
    </script>
{% endblock %}